/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.seguradora.util;

import com.towel.bean.Formatter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Diego
 */
public class DateFormatter implements Formatter {

    SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy");

    @Override
    public String format(Object arg0) {
        return format.format((Date) arg0);
    }

    @Override
    public String getName() {
        return "date";
    }

    @Override
    public Object parse(Object arg0) {
        Date date = null;
        try {
            date = format.parse(arg0.toString());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}
